package graphicinterface;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;

import javax.swing.JButton;

	//button found on http://stackoverflow.com/questions/12749362/how-to-set-custom-gradient-for-jbutton
    public class JGradientButton extends JButton
    {
        /**
		 * 
		 */
		private static final long serialVersionUID = 1L;
		Color color1 = Color.WHITE;
        Color color2 = Color.PINK;
        public JGradientButton(String buttonLabel)
        {
            super(buttonLabel);
            setContentAreaFilled(false);
            setFocusPainted(false);
           

        }

        @Override
        protected void paintComponent(Graphics g){
            Graphics2D g2 = (Graphics2D)g.create();
            g2.setPaint(new GradientPaint(
                    new Point(0, 0), 
                    color1, 
                    new Point(0, getHeight()), 
                    color2));
            g2.fillRect(0, 0, getWidth(), getHeight());
            g2.dispose();

            super.paintComponent(g);
        }


    }
